import java.util.*;

/**
 * @author chen
 */
public class GenericLearn {

    public static void main(String[] args) {
        List<Object> l = new ArrayList<>();
        l.add("1");
        l.add(1);
        test(l);


        HashMap hashMap = new HashMap(8);
        hashMap.put("a", 2);
        hashMap.put("b", 2.0);
        test2(hashMap);
    }

    public static <T> void test(List<T> a) {
        System.out.println(a.get(0).getClass());
        System.out.println(a.get(1).getClass());
    }

    public static void test2(Map<? extends String, ? super Integer> m) {
        for (Map.Entry<? extends String, ? super Integer> entry : m.entrySet()) {
            System.out.println(entry);
            System.out.println(entry.getValue().getClass());
        }
    }
}
